/**
 * @author antonio081014
 * @since Jan 14, 2012, 9:58:34 AM
 */

public class MinskyMysteryDiv2 {
    public long computeAnswer(long N) {
        if (N < 2)
            return -1;
        for (long i = 2; i * i <= N; ++i)
            if (N % i == 0)
                return i + (N / i);
        return N + 1;
    }

    // <%:testing-code%>
}
// Powered by [KawigiEdit] 2.0!
